include('js/jquery.easing.1.3.js');
include('js/jquery-ui-1.8.20.custom.min.js');
include('js/jquery.transform-0.9.3.min.js');
include('js/jquery.animate-colors-min.js');
include('js/jquery.backgroundpos.min.js');
include('js/mathUtils.js');
include('js/superfish.js');
include('js/switcher.js');
include('js/jquery.mousewheel.js');
include('js/sprites.js');
include('js/hoverSprite.js');
include('js/slider.js');
include('js/cScroll.js');
include('js/forms.js');
include('js/bgStretch.js');
include('js/sImg.js');
include('js/jquery.jrumble.1.3.min.js.js');




//----Include-Function----
function include(url){ 
  document.write('<script src="'+ url + '" type="text/javascript"></script>'); 
}

function alpPad(){
	$('.figure2 img').css({top:"-442px"}).stop().delay(100).animate({top:"0px"}, 5000,'easeOutCirc');
}

function uslugeRestart(){
	document.getElementById("myframe").src = "usluge/mapaUma-finaNew1.html";
}



//--------global-------------
var isSplash = true;
var isIcon = true;
var isOver = false;
//------DocReady-------------
$(document).ready(function(){ 
    if(location.hash.length == 0){
        location.hash="!/"+$('#content > ul > li:first-child').attr('id');
    }

     $('ul#menu').superfish({
          delay:       800,
          animation:   {height:'show'},
          speed:       600,
          autoArrows:  false,
         dropShadows: false,
         	onInit: function(){
  				$("#menu > li > a").each(function(index){
  					var conText = $(this).find('.mText').text();
 					$(this).append("<span class='mTextOver'>"+conText+"</span>")	
  				})
  	 		}
        });
});
  
 //------WinLoad-------------  
$(window).load(function(){  
       MSIE = ($.browser.msie) && ($.browser.version <= 8);
$(".closeButton > a").hoverSprite({onLoadWebSite: true});
$(".playButton > a").hoverSprite({onLoadWebSite: true});
$(".buyButton > a").hoverSprite({onLoadWebSite: true});
$('.more').sprites({method:'gStretch',hover:true});


	$('#bgStretch').bgStretch({align:'rightBottom'});

	
	
	$(".centar").click(function () {
         $(this).hide("fade", {}, 1000);
         $('.sinapse').delay(10000).show("fade", {}, 1000);
         $(this).delay(11000).show("fade", {}, 300);
         
         $('.defektaza').css({'display':'block'});
         $('.defektaza > img').show("scale", {}, 1000);
         
         setTimeout( function(){
        	 $('.hidroizolacija').css({'display':'block'});
           },1000);
         $('.hidroizolacija > img').delay(1000).show("scale", {}, 1000);
         
         setTimeout( function(){
        	 $('.molerskoFarbarskiRadovi').css({'display':'block'});
           },2000);
         $('.molerskoFarbarskiRadovi > img').delay(2000).show("scale", {}, 1000);
         
         setTimeout( function(){
        	 $('.termika').css({'display':'block'});
           },3000);
         $('.termika > img').delay(3000).show("scale", {}, 1000);
         
         setTimeout( function(){
        	 $('.zastitaOdSnegaILeda').css({'display':'block'});
           },4000);
         $('.zastitaOdSnegaILeda > img').delay(4000).show("scale", {}, 1000);
         
         setTimeout( function(){
        	 $('.odrzavanje').css({'display':'block'});
           },5000);
         $('.odrzavanje > img').delay(5000).show("scale", {}, 1000);
         
         setTimeout( function(){
        	 $('.montaza').css({'display':'block'});
           },6000);
         $('.montaza > img').delay(6000).show("scale", {}, 1000);
         
         setTimeout( function(){
        	 $('.sanacija').css({'display':'block'});
           },7000);
         $('.sanacija > img').delay(7000).show("scale", {}, 1000);
         
         setTimeout( function(){
        	 $('.zastitaOdPtica').css({'display':'block'});
           },8000);
         $('.zastitaOdPtica > img').delay(8000).show("scale", {}, 1000);
         
         setTimeout( function(){
        	 $('.pranje').css({'display':'block'});
           },9000);
         $('.pranje > img').delay(9000).show("scale", {}, 1000);
         
         $('#demo1').jrumble({
        		x: 2,
        		y: 2,
        		rotation: 1
        	});
   });
	
	
 $('.scroll1').cScroll({
		duration:700,
		step:100,
		trackCl:'track',
		shuttleCl:'shuttle',
         hoverIn: function(_shuttle){
            if (!MSIE){
                _shuttle.stop().animate({'backgroundPosition':'0 100%'},400,'easeOutExpo');  
            } else {
                _shuttle.css({'backgroundPosition':'0 100%'});   
            }
        },
        hoverOut: function (_shuttle){
            if (!MSIE){
                _shuttle.stop().animate({'backgroundPosition':'0 0%'},400,'easeOutExpo');  
            } else{
                _shuttle.css({'backgroundPosition':'0 0%'});   
            }
        }
	})
    
     $('.scroll2').cScroll({
		duration:700,
		step:100,
		trackCl:'track2',
		shuttleCl:'shuttle2',
         hoverIn: function(_shuttle){
            if (!MSIE){
               _shuttle.stop().animate({'backgroundPosition':'0 100%'},400,'easeOutExpo');  
            } else {
                _shuttle.css({'backgroundPosition':'0 100%'});  
            }
        },
        hoverOut: function (_shuttle){
            if (!MSIE){
                _shuttle.stop().animate({'backgroundPosition':'0 0%'},400,'easeOutExpo');  
            } else {
               _shuttle.css({'backgroundPosition':'0 0%'});  
            }
        }
	})
    $('.scroll3').cScroll({
		duration:700,
		step:100,
		trackCl:'track3',
		shuttleCl:'shuttle3',
         hoverIn: function(_shuttle){
            if (!MSIE){
                _shuttle.stop().animate({'backgroundPosition':'0 100%'},400,'easeOutExpo');               
            } else {
                _shuttle.css({'backgroundPosition':'0 100%'}); 
            }
        },
        hoverOut: function (_shuttle){
            if (!MSIE){
                _shuttle.stop().animate({'backgroundPosition':'0 0%'},400,'easeOutExpo'); 
            } else {
                _shuttle.css({'backgroundPosition':'0 0%'}); 
            }
        }
	})

     
 $('.more').hover(
    function(){
         $(this).stop(true).animate({color:'#fff'}, 500, 'easeOutExpo');
    },
    function(){
        $(this).stop(true).animate({color:'#020102'}, 500, 'easeOutExpo');
    }
 )      
      
       
var menuItems = $('#menu >li'); 
var currentIm = 0;
var lastIm = 0;

navInit();
function navInit(){
$('.title').css({'display':'block',left:"1700px", opacity:0.25}).stop().delay(100).animate({left:"0px"}, 1000,'easeOutCirc');
$('.logoHolder').css({'display':'block',left:"-1707px"}).stop().delay(100).animate({left:"-7px"}, 1000,'easeOutCirc');
}


///////////////////////////////////////////////
    var navItems = $('.menu > ul >li');

    $('.menu > ul >li').eq(0).css({'display':'none'});
	var content=$('#content'),
		nav=$('.menu');

    	$('#content').tabs({
		preFu:function(_){
			_.li.css({left:"-1700px",'display':'none'});
		}
		,actFu:function(_){			
			if(_.curr){
				_.curr.css({'display':'block',left:"-1700px"}).stop().delay(100).animate({left:"0px"}, 800,'easeOutCirc');
                if ((_.n == 0) && ((_.pren>0) || (_.pren==undefined))){splashMode();}
                if (((_.pren == 0) || (_.pren == undefined)) && (_.n>0) ){contentMode(); }
            }
			if(_.prev){
			     _.prev.stop().animate({left:'1700px'},450,'easeInCubic', function(){_.prev.css({'display':'none'});});
             }
		}
	})
    

    function splashMode(){
        isSplash = true;
 
    }
    
    function contentMode(){  
        isSplash = false;

    }		
    
	nav.navs({
			useHash:true,
             hoverIn:function(li){
                $(".mText", li).stop(true).animate({top:'60px'}, 400, 'easeOutExpo');
                $(".mTextOver", li).stop(true).animate({top:'0px'}, 400, 'easeOutBack');
                   // if(($.browser.msie) && ($.browser.version <= 8)){}else{}
             },
                hoverOut:function(li){
                    if ((!li.hasClass('with_ul')) || (!li.hasClass('sfHover'))) {
                        $(".mText", li).stop(true).animate({top:'0px'}, 400, 'easeOutBack');
                        $(".mTextOver", li).stop(true).animate({top:'-60px'}, 400, 'easeOutExpo');
                    } 
                } 
		})

		.navs(function(n){			
			$('#content').tabs(n);
		})

//////////////////////////////////////////
   	var h_cont=825;
	function centrRepos() {
		var h=$(window).height();
		if (h>(h_cont+40)) {
			m_top=~~(h-h_cont)/2;
			h_new=h;
		} else {
			m_top=20;
			h_new=h_cont+40;
		}
		$('.center').stop().animate({paddingTop:m_top},800,'easeOutExpo');
   
	}
	centrRepos();
    ///////////Window resize///////
    
    function windowW() {
 return (($(window).width()>=parseInt($('body').css('minWidth')))?$(window).width():parseInt($('body').css('minWidth')));
}
    
    
	$(window).resize(function(){
        centrRepos();
         
        }
    );

    } //window function
) //window load